const path = require('path')
const resolve = (filePath) => path.join(__dirname, './', filePath)

module.exports = {
  outputDir: 'docs',
  publicPath: './',
  devServer: { port: '3366' },
  pages: {
    index: {
      entry: resolve('story/main.ts'),
      template: 'public/index.html',
      filename: 'index.html',
      title: 'v3-components',
    },
  },
  chainWebpack: (config) => {
    // 删除了prefetch-index以及preload-index两个插件
    // 这两个插件会在我们的index单页面中的script标签加上 defer以及async属性，导致我们demo示例页面按需加载失效
    config.plugins.delete('prefetch-index').delete('preload-index')
    config.resolve.alias.set('story', resolve('story'))
  },
}
